<?php
if(isset($_POST["addcart"]))
{
    session_start();
    $id=$_POST['id'];
    $name=$_POST['name'];
    $price=$_POST['price'];
    $num=$_POST['num'];
    $size="";
    $image=$_POST['image'];
    if(isset($_SESSION['cart']))
    {
    $so = count($_SESSION['cart']);
    if($so = 0)
    {
        $_SESSION['cart']=array(array($id,$name,$price,$num,$size,$image));
    }
    else
    {
    array_push($_SESSION['cart'],(array($id,$name,$price,$num,$size,$image)));
    }
    }
    else
    {
        $_SESSION['cart']=array(array($id,$name,$price,$num,$size,$image));
    }
    echo "<script>window.history.go(-1);</script>";
}
?>